<?php
$page->title = 'Delegate or code?';
$page->date = '2012-07-10';
?>

<h1><?= $page->title() ?></h1>
<hr class="readmore">

<h1><?= $page->title() ?></h1>

<aside>
  <a href="http://www.phptherightway.com" target="_blank">
      <img
      src="http://www.phptherightway.com/images/banners/lg-rect-386x280.png"
      alt="PHP: The Right Way"/>
  </a>
</aside>

<p>Thank you RSS feed or Twitter, or whatever it was that fed me this webpage: <a href="http://www.phptherightway.com/"
target="_blank">PHP The Right Way</a>.  You suck.</p>

<p>Sure, I picked up PHP on my own, but now I know that I have a long way to go.  I knew what namespaces were, but not
that I should be using them&mdash;and to be fair, right now I cannot due to my host using PHP 5.2. After some quick
research on whether implementing these new &lsquo;best practices&rsquo; would break my site, I read the site again to
see what I CAN begin doing today.</p>

<p>The answer was right at the beginning of the site&hellip; the code style guide. What a great, and wholly not new
idea. It seems that every time I read some code on GitHub or snippets from sites, I adopt a part of their code styling.
This makes fraken-code and a preserved history of strata throughout my projects. Not any more.  Check out these aptly
named style guides:</p>

<ul>
  <li><a href="https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md" target="_blank">PSR-0</a></li>
  <li><a href="https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md"
  target="_blank">PSR-1</a></li>
  <li><a href="https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md"
  target="_blank">PSR-2</a></li>
</ul>

<p>Sorry PSR-0, but we can probably ignore you (until we get to play with PHP &gt;= 5.3). The other two are brilliant
and I need to start yesterday. The main nugget for me is one overarching goal: readibility. The first time I looked at
Wordpress code, I fell in love. Not initially because of it&rsquo;s inherent wisdom, but because it was beautiful. My
code is not beautiful.</p>

<p>A close second piece of wisdom is that files should either declare symbols or cause side-effects. This sounds very
much like MVC and though I haven&rsquo;t thought through how this will effect my code, I love the idea.</p>

<p>So back to my inital contempt, thanks. No, really. Now I have to rethink all of my code. The upside is that it will
be better as a result.</p>

<p>Hello World!</p>

<hr> <h2>Update</h2>

<p>I write using Vim. I love the ability to move around using only the keyboard.  As I use Vim I pickup these neat
little tips here and there. To comply with the PSR-2 guideline for line width, this is what I use:

<pre>
" set textwidth to 80
:set tw=120
" but now Vim will insert a line break while I type and I hate this
" so now set formatoptions toggle flag to OFF
:set fo-=t
" now, using colorcolumn, show me the columns at 80 and 120
:set cc=-40,+0
</pre>

<p>Now, when I write body content which is text, I don&lsquo;t mind the wrapping, but rather than forcing it with
textwidth and automatic line breaks, try this one on for size&hellip; Use SHIFT+V to enter Visual Line mode, select
everything to fromat, then type 'gq' and TADA&hellip; your code is now reformatted to textwidth. Even simpler: with your
cursor inside a paragraph of text, type 'vip' which enters Visual mode and selets the inner paragraph (basically
everything between the preceeding and following empty line.</p>

<p>credit <a href="http://blog.ezyang.com/2010/03/vim-textwidth/" target="_blank">Edward Z. Yang on Inside 233</a></p>
